/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    ap-northeast-1 = 'cccxspace.aliyuncs.com',
    ap-northeast-2-pop = 'cccxspace.aliyuncs.com',
    ap-south-1 = 'cccxspace.aliyuncs.com',
    ap-southeast-1 = 'cccxspace.aliyuncs.com',
    ap-southeast-2 = 'cccxspace.aliyuncs.com',
    ap-southeast-3 = 'cccxspace.aliyuncs.com',
    ap-southeast-5 = 'cccxspace.aliyuncs.com',
    cn-beijing = 'cccxspace.aliyuncs.com',
    cn-beijing-finance-1 = 'cccxspace.aliyuncs.com',
    cn-beijing-finance-pop = 'cccxspace.aliyuncs.com',
    cn-beijing-gov-1 = 'cccxspace.aliyuncs.com',
    cn-beijing-nu16-b01 = 'cccxspace.aliyuncs.com',
    cn-chengdu = 'cccxspace.aliyuncs.com',
    cn-edge-1 = 'cccxspace.aliyuncs.com',
    cn-fujian = 'cccxspace.aliyuncs.com',
    cn-haidian-cm12-c01 = 'cccxspace.aliyuncs.com',
    cn-hangzhou = 'cccxspace.aliyuncs.com',
    cn-hangzhou-bj-b01 = 'cccxspace.aliyuncs.com',
    cn-hangzhou-finance = 'cccxspace.aliyuncs.com',
    cn-hangzhou-internal-prod-1 = 'cccxspace.aliyuncs.com',
    cn-hangzhou-internal-test-1 = 'cccxspace.aliyuncs.com',
    cn-hangzhou-internal-test-2 = 'cccxspace.aliyuncs.com',
    cn-hangzhou-internal-test-3 = 'cccxspace.aliyuncs.com',
    cn-hangzhou-test-306 = 'cccxspace.aliyuncs.com',
    cn-hongkong = 'cccxspace.aliyuncs.com',
    cn-hongkong-finance-pop = 'cccxspace.aliyuncs.com',
    cn-huhehaote = 'cccxspace.aliyuncs.com',
    cn-huhehaote-nebula-1 = 'cccxspace.aliyuncs.com',
    cn-north-2-gov-1 = 'cccxspace.aliyuncs.com',
    cn-qingdao = 'cccxspace.aliyuncs.com',
    cn-qingdao-nebula = 'cccxspace.aliyuncs.com',
    cn-shanghai-et15-b01 = 'cccxspace.aliyuncs.com',
    cn-shanghai-et2-b01 = 'cccxspace.aliyuncs.com',
    cn-shanghai-finance-1 = 'cccxspace.aliyuncs.com',
    cn-shanghai-inner = 'cccxspace.aliyuncs.com',
    cn-shanghai-internal-test-1 = 'cccxspace.aliyuncs.com',
    cn-shenzhen = 'cccxspace.aliyuncs.com',
    cn-shenzhen-finance-1 = 'cccxspace.aliyuncs.com',
    cn-shenzhen-inner = 'cccxspace.aliyuncs.com',
    cn-shenzhen-st4-d01 = 'cccxspace.aliyuncs.com',
    cn-shenzhen-su18-b01 = 'cccxspace.aliyuncs.com',
    cn-wuhan = 'cccxspace.aliyuncs.com',
    cn-wulanchabu = 'cccxspace.aliyuncs.com',
    cn-yushanfang = 'cccxspace.aliyuncs.com',
    cn-zhangbei = 'cccxspace.aliyuncs.com',
    cn-zhangbei-na61-b01 = 'cccxspace.aliyuncs.com',
    cn-zhangjiakou = 'cccxspace.aliyuncs.com',
    cn-zhangjiakou-na62-a01 = 'cccxspace.aliyuncs.com',
    cn-zhengzhou-nebula-1 = 'cccxspace.aliyuncs.com',
    eu-central-1 = 'cccxspace.aliyuncs.com',
    eu-west-1 = 'cccxspace.aliyuncs.com',
    eu-west-1-oxs = 'cccxspace.aliyuncs.com',
    me-east-1 = 'cccxspace.aliyuncs.com',
    rus-west-1-pop = 'cccxspace.aliyuncs.com',
    us-east-1 = 'cccxspace.aliyuncs.com',
    us-west-1 = 'cccxspace.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('cccxspace', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddAccountAsInstanceRequest {
  instanceId?: string(name='InstanceId'),
  userIds?: [ long ](name='UserIds'),
}

model AddAccountAsInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddAccountAsInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddAccountAsInstanceResponseBody(name='body'),
}

async function addAccountAsInstanceWithOptions(request: AddAccountAsInstanceRequest, runtime: Util.RuntimeOptions): AddAccountAsInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userIds)) {
    query['UserIds'] = request.userIds;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddAccountAsInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addAccountAsInstance(request: AddAccountAsInstanceRequest): AddAccountAsInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return addAccountAsInstanceWithOptions(request, runtime);
}

model AddInstanceUserRequest {
  buName?: string(name='BuName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  loginName?: string(name='LoginName'),
  phoneNumber?: string(name='PhoneNumber'),
  realName?: string(name='RealName'),
}

model AddInstanceUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddInstanceUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddInstanceUserResponseBody(name='body'),
}

async function addInstanceUserWithOptions(request: AddInstanceUserRequest, runtime: Util.RuntimeOptions): AddInstanceUserResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.buName)) {
    body['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.email)) {
    body['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.loginName)) {
    body['LoginName'] = request.loginName;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.realName)) {
    body['RealName'] = request.realName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddInstanceUser',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addInstanceUser(request: AddInstanceUserRequest): AddInstanceUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return addInstanceUserWithOptions(request, runtime);
}

model AddInstanceUserSaleRequest {
  buName?: string(name='BuName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  loginName?: string(name='LoginName'),
  phoneNumber?: string(name='PhoneNumber'),
  realName?: string(name='RealName'),
}

model AddInstanceUserSaleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddInstanceUserSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddInstanceUserSaleResponseBody(name='body'),
}

async function addInstanceUserSaleWithOptions(request: AddInstanceUserSaleRequest, runtime: Util.RuntimeOptions): AddInstanceUserSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.buName)) {
    body['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.email)) {
    body['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.loginName)) {
    body['LoginName'] = request.loginName;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.realName)) {
    body['RealName'] = request.realName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddInstanceUserSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addInstanceUserSale(request: AddInstanceUserSaleRequest): AddInstanceUserSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return addInstanceUserSaleWithOptions(request, runtime);
}

model AddUserRequest {
  buName?: string(name='BuName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  loginName?: string(name='LoginName'),
  phoneNumber?: string(name='PhoneNumber'),
  realName?: string(name='RealName'),
}

model AddUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddUserResponseBody(name='body'),
}

async function addUserWithOptions(request: AddUserRequest, runtime: Util.RuntimeOptions): AddUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.buName)) {
    query['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.loginName)) {
    query['LoginName'] = request.loginName;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.realName)) {
    query['RealName'] = request.realName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddUser',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addUser(request: AddUserRequest): AddUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return addUserWithOptions(request, runtime);
}

model ChangeGradeAliyunInstanceRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  instanceId?: string(name='InstanceId'),
}

model ChangeGradeAliyunInstanceResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeGradeAliyunInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeGradeAliyunInstanceResponseBody(name='body'),
}

async function changeGradeAliyunInstanceWithOptions(request: ChangeGradeAliyunInstanceRequest, runtime: Util.RuntimeOptions): ChangeGradeAliyunInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeGradeAliyunInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeGradeAliyunInstance(request: ChangeGradeAliyunInstanceRequest): ChangeGradeAliyunInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeGradeAliyunInstanceWithOptions(request, runtime);
}

model ChangeGradeAliyunInstanceSaleRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  instanceId?: string(name='InstanceId'),
}

model ChangeGradeAliyunInstanceSaleResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeGradeAliyunInstanceSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeGradeAliyunInstanceSaleResponseBody(name='body'),
}

async function changeGradeAliyunInstanceSaleWithOptions(request: ChangeGradeAliyunInstanceSaleRequest, runtime: Util.RuntimeOptions): ChangeGradeAliyunInstanceSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeGradeAliyunInstanceSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeGradeAliyunInstanceSale(request: ChangeGradeAliyunInstanceSaleRequest): ChangeGradeAliyunInstanceSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeGradeAliyunInstanceSaleWithOptions(request, runtime);
}

model CheckAliyunInstanceStatusSaleRequest {
  instanceId?: string(name='InstanceId'),
  projectId?: string(name='ProjectId'),
}

model CheckAliyunInstanceStatusSaleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CheckAliyunInstanceStatusSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckAliyunInstanceStatusSaleResponseBody(name='body'),
}

async function checkAliyunInstanceStatusSaleWithOptions(request: CheckAliyunInstanceStatusSaleRequest, runtime: Util.RuntimeOptions): CheckAliyunInstanceStatusSaleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckAliyunInstanceStatusSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkAliyunInstanceStatusSale(request: CheckAliyunInstanceStatusSaleRequest): CheckAliyunInstanceStatusSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkAliyunInstanceStatusSaleWithOptions(request, runtime);
}

model CheckCardUsedOrNotRequest {
  cardId?: long(name='CardId'),
  instanceId?: string(name='InstanceId'),
}

model CheckCardUsedOrNotResponseBody = {
  data?: {
    checkResult?: boolean(name='CheckResult'),
    sopList?: [ 
      {
        flowId?: long(name='FlowId'),
        sopCode?: string(name='SopCode'),
        sopName?: string(name='SopName'),
        status?: string(name='Status'),
        statusDesc?: string(name='StatusDesc'),
      }
    ](name='SopList'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  code?: string(name='code'),
}

model CheckCardUsedOrNotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckCardUsedOrNotResponseBody(name='body'),
}

async function checkCardUsedOrNotWithOptions(request: CheckCardUsedOrNotRequest, runtime: Util.RuntimeOptions): CheckCardUsedOrNotResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.cardId)) {
    query['CardId'] = request.cardId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckCardUsedOrNot',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkCardUsedOrNot(request: CheckCardUsedOrNotRequest): CheckCardUsedOrNotResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkCardUsedOrNotWithOptions(request, runtime);
}

model CheckOpenResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CheckOpenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckOpenResponseBody(name='body'),
}

async function checkOpenWithOptions(runtime: Util.RuntimeOptions): CheckOpenResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'CheckOpen',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkOpen(): CheckOpenResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkOpenWithOptions(runtime);
}

model CheckOpenSaleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CheckOpenSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckOpenSaleResponseBody(name='body'),
}

async function checkOpenSaleWithOptions(runtime: Util.RuntimeOptions): CheckOpenSaleResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'CheckOpenSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkOpenSale(): CheckOpenSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkOpenSaleWithOptions(runtime);
}

model CheckOpenXspaceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  status?: boolean(name='Status'),
  success?: boolean(name='Success'),
}

model CheckOpenXspaceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckOpenXspaceResponseBody(name='body'),
}

async function checkOpenXspaceWithOptions(runtime: Util.RuntimeOptions): CheckOpenXspaceResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'CheckOpenXspace',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkOpenXspace(): CheckOpenXspaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkOpenXspaceWithOptions(runtime);
}

model CreateAliyunInstanceNewRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  description?: string(name='Description'),
  environment?: string(name='Environment'),
  instanceComponent?: string(name='InstanceComponent'),
  instanceId?: string(name='InstanceId'),
  instanceName?: string(name='InstanceName'),
  region?: string(name='Region'),
  source?: long(name='Source'),
  userId?: string(name='UserId'),
}

model CreateAliyunInstanceNewResponseBody = {
  code?: string(name='Code'),
  data?: {
    buId?: long(name='BuId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateAliyunInstanceNewResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAliyunInstanceNewResponseBody(name='body'),
}

async function createAliyunInstanceNewWithOptions(request: CreateAliyunInstanceNewRequest, runtime: Util.RuntimeOptions): CreateAliyunInstanceNewResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.environment)) {
    body['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.instanceComponent)) {
    body['InstanceComponent'] = request.instanceComponent;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.source)) {
    body['Source'] = request.source;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAliyunInstanceNew',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAliyunInstanceNew(request: CreateAliyunInstanceNewRequest): CreateAliyunInstanceNewResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAliyunInstanceNewWithOptions(request, runtime);
}

model CreateAliyunInstanceNewSaleRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  description?: string(name='Description'),
  environment?: string(name='Environment'),
  instanceComponent?: string(name='InstanceComponent'),
  instanceId?: string(name='InstanceId'),
  instanceName?: string(name='InstanceName'),
  region?: string(name='Region'),
  source?: long(name='Source'),
  userId?: string(name='UserId'),
}

model CreateAliyunInstanceNewSaleResponseBody = {
  code?: string(name='Code'),
  data?: {
    buId?: long(name='BuId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateAliyunInstanceNewSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAliyunInstanceNewSaleResponseBody(name='body'),
}

async function createAliyunInstanceNewSaleWithOptions(request: CreateAliyunInstanceNewSaleRequest, runtime: Util.RuntimeOptions): CreateAliyunInstanceNewSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.environment)) {
    body['Environment'] = request.environment;
  }
  if (!Util.isUnset(request.instanceComponent)) {
    body['InstanceComponent'] = request.instanceComponent;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.source)) {
    body['Source'] = request.source;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAliyunInstanceNewSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAliyunInstanceNewSale(request: CreateAliyunInstanceNewSaleRequest): CreateAliyunInstanceNewSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAliyunInstanceNewSaleWithOptions(request, runtime);
}

model CreateMemberTypeBySourceIdRequest {
  authId?: string(name='AuthId'),
  description?: string(name='Description'),
  identityType?: long(name='IdentityType'),
  name?: string(name='Name'),
  tenantId?: string(name='TenantId'),
}

model CreateMemberTypeBySourceIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    bindResult?: boolean(name='BindResult'),
    memberType?: string(name='MemberType'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateMemberTypeBySourceIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateMemberTypeBySourceIdResponseBody(name='body'),
}

async function createMemberTypeBySourceIdWithOptions(request: CreateMemberTypeBySourceIdRequest, runtime: Util.RuntimeOptions): CreateMemberTypeBySourceIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.authId)) {
    query['AuthId'] = request.authId;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.identityType)) {
    query['IdentityType'] = request.identityType;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateMemberTypeBySourceId',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createMemberTypeBySourceId(request: CreateMemberTypeBySourceIdRequest): CreateMemberTypeBySourceIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return createMemberTypeBySourceIdWithOptions(request, runtime);
}

model CreateSkillGroupRequest {
  channelType?: int32(name='ChannelType'),
  description?: string(name='Description'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  skillGroupName?: string(name='SkillGroupName'),
}

model CreateSkillGroupResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSkillGroupResponseBody(name='body'),
}

async function createSkillGroupWithOptions(request: CreateSkillGroupRequest, runtime: Util.RuntimeOptions): CreateSkillGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupName)) {
    body['SkillGroupName'] = request.skillGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSkillGroup',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSkillGroup(request: CreateSkillGroupRequest): CreateSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSkillGroupWithOptions(request, runtime);
}

model CreateSubTicketRequest {
  agentId?: long(name='AgentId'),
  bizData?: string(name='BizData'),
  creatorId?: long(name='CreatorId'),
  creatorName?: string(name='CreatorName'),
  formData?: string(name='FormData'),
  fromInfo?: string(name='FromInfo'),
  instanceId?: string(name='InstanceId'),
  memberId?: long(name='MemberId'),
  memberName?: string(name='MemberName'),
  parentCaseId?: long(name='ParentCaseId'),
  priority?: int32(name='Priority'),
  templateId?: long(name='TemplateId'),
}

model CreateSubTicketResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateSubTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSubTicketResponseBody(name='body'),
}

async function createSubTicketWithOptions(request: CreateSubTicketRequest, runtime: Util.RuntimeOptions): CreateSubTicketResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentId)) {
    query['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.bizData)) {
    query['BizData'] = request.bizData;
  }
  if (!Util.isUnset(request.creatorId)) {
    query['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.creatorName)) {
    query['CreatorName'] = request.creatorName;
  }
  if (!Util.isUnset(request.formData)) {
    query['FormData'] = request.formData;
  }
  if (!Util.isUnset(request.fromInfo)) {
    query['FromInfo'] = request.fromInfo;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    query['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    query['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.parentCaseId)) {
    query['ParentCaseId'] = request.parentCaseId;
  }
  if (!Util.isUnset(request.priority)) {
    query['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSubTicket',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSubTicket(request: CreateSubTicketRequest): CreateSubTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSubTicketWithOptions(request, runtime);
}

model CreateXspaceCommodityInstanceRequest {
  alipkUserId?: long(name='AlipkUserId'),
  chargetype?: string(name='Chargetype'),
  commodityCode?: string(name='CommodityCode'),
  commodityInstanceComponent?: string(name='CommodityInstanceComponent'),
  commodityInstanceId?: string(name='CommodityInstanceId'),
  commodityInstanceName?: string(name='CommodityInstanceName'),
  endDate?: long(name='EndDate'),
  env?: string(name='Env'),
  hotlineSeatNum?: int32(name='HotlineSeatNum'),
  hotlineVersion?: string(name='HotlineVersion'),
  onlineSeatNum?: int32(name='OnlineSeatNum'),
  onlineVersion?: string(name='OnlineVersion'),
  region?: string(name='Region'),
  startDate?: long(name='StartDate'),
}

model CreateXspaceCommodityInstanceResponseBody = {
  buId?: long(name='BuId'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateXspaceCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateXspaceCommodityInstanceResponseBody(name='body'),
}

async function createXspaceCommodityInstanceWithOptions(request: CreateXspaceCommodityInstanceRequest, runtime: Util.RuntimeOptions): CreateXspaceCommodityInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alipkUserId)) {
    query['AlipkUserId'] = request.alipkUserId;
  }
  if (!Util.isUnset(request.chargetype)) {
    query['Chargetype'] = request.chargetype;
  }
  if (!Util.isUnset(request.commodityCode)) {
    query['CommodityCode'] = request.commodityCode;
  }
  if (!Util.isUnset(request.commodityInstanceComponent)) {
    query['CommodityInstanceComponent'] = request.commodityInstanceComponent;
  }
  if (!Util.isUnset(request.commodityInstanceId)) {
    query['CommodityInstanceId'] = request.commodityInstanceId;
  }
  if (!Util.isUnset(request.commodityInstanceName)) {
    query['CommodityInstanceName'] = request.commodityInstanceName;
  }
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.env)) {
    query['Env'] = request.env;
  }
  if (!Util.isUnset(request.hotlineSeatNum)) {
    query['HotlineSeatNum'] = request.hotlineSeatNum;
  }
  if (!Util.isUnset(request.hotlineVersion)) {
    query['HotlineVersion'] = request.hotlineVersion;
  }
  if (!Util.isUnset(request.onlineSeatNum)) {
    query['OnlineSeatNum'] = request.onlineSeatNum;
  }
  if (!Util.isUnset(request.onlineVersion)) {
    query['OnlineVersion'] = request.onlineVersion;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateXspaceCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createXspaceCommodityInstance(request: CreateXspaceCommodityInstanceRequest): CreateXspaceCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createXspaceCommodityInstanceWithOptions(request, runtime);
}

model DeleteXsInstanceRequest {
  instanceId?: string(name='InstanceId'),
}

model DeleteXsInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteXsInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteXsInstanceResponseBody(name='body'),
}

async function deleteXsInstanceWithOptions(request: DeleteXsInstanceRequest, runtime: Util.RuntimeOptions): DeleteXsInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteXsInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteXsInstance(request: DeleteXsInstanceRequest): DeleteXsInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteXsInstanceWithOptions(request, runtime);
}

model DescribeInstanceRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model DescribeInstanceResponseBody = {
  code?: string(name='Code'),
  data?: {
    commodityInstance?: {
      administrator?: {
        accountName?: string(name='AccountName'),
        email?: string(name='Email'),
        name?: string(name='Name'),
        phoneNumber?: string(name='PhoneNumber'),
      }(name='Administrator'),
      commodities?: [ string ](name='Commodities'),
      commodityInstanceId?: string(name='CommodityInstanceId'),
      commodityInstanceName?: string(name='CommodityInstanceName'),
      description?: string(name='Description'),
    }(name='CommodityInstance'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeInstanceResponseBody(name='body'),
}

async function describeInstanceWithOptions(request: DescribeInstanceRequest, runtime: Util.RuntimeOptions): DescribeInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    body['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeInstance(request: DescribeInstanceRequest): DescribeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceWithOptions(request, runtime);
}

model DescribeInstanceSaleRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model DescribeInstanceSaleResponseBody = {
  code?: string(name='Code'),
  data?: {
    commodityInstance?: {
      administrator?: {
        accountName?: string(name='AccountName'),
        email?: string(name='Email'),
        name?: string(name='Name'),
        phoneNumber?: string(name='PhoneNumber'),
      }(name='Administrator'),
      commodities?: [ string ](name='Commodities'),
      commodityInstanceId?: string(name='CommodityInstanceId'),
      commodityInstanceName?: string(name='CommodityInstanceName'),
      description?: string(name='Description'),
    }(name='CommodityInstance'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeInstanceSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeInstanceSaleResponseBody(name='body'),
}

async function describeInstanceSaleWithOptions(request: DescribeInstanceSaleRequest, runtime: Util.RuntimeOptions): DescribeInstanceSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    body['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeInstanceSale(request: DescribeInstanceSaleRequest): DescribeInstanceSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceSaleWithOptions(request, runtime);
}

model DescribeXsInstanceRequest {
  instanceId?: string(name='InstanceId'),
}

model DescribeXsInstanceResponseBody = {
  code?: string(name='Code'),
  commodityInstance?: {
    administrator?: {
      email?: string(name='Email'),
      id?: long(name='Id'),
      name?: string(name='Name'),
      phoneNumber?: string(name='PhoneNumber'),
      userName?: string(name='UserName'),
    }(name='Administrator'),
    description?: string(name='Description'),
    endData?: long(name='EndData'),
    hotlineSeatNum?: int32(name='HotlineSeatNum'),
    instanceId?: string(name='InstanceId'),
    name?: string(name='Name'),
    onlineSeatNum?: int32(name='OnlineSeatNum'),
    startData?: long(name='StartData'),
    status?: int32(name='Status'),
  }(name='CommodityInstance'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeXsInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeXsInstanceResponseBody(name='body'),
}

async function describeXsInstanceWithOptions(request: DescribeXsInstanceRequest, runtime: Util.RuntimeOptions): DescribeXsInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeXsInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeXsInstance(request: DescribeXsInstanceRequest): DescribeXsInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeXsInstanceWithOptions(request, runtime);
}

model DisplayInstanceUserRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model DisplayInstanceUserResponseBody = {
  code?: string(name='Code'),
  data?: {
    administratorInfo?: {
      buName?: string(name='BuName'),
      email?: string(name='Email'),
      logName?: string(name='LogName'),
      phoneNumber?: string(name='PhoneNumber'),
      realName?: string(name='RealName'),
    }(name='AdministratorInfo'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisplayInstanceUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisplayInstanceUserResponseBody(name='body'),
}

async function displayInstanceUserWithOptions(request: DisplayInstanceUserRequest, runtime: Util.RuntimeOptions): DisplayInstanceUserResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    body['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisplayInstanceUser',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function displayInstanceUser(request: DisplayInstanceUserRequest): DisplayInstanceUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return displayInstanceUserWithOptions(request, runtime);
}

model DisplayInstanceUserSaleRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model DisplayInstanceUserSaleResponseBody = {
  code?: string(name='Code'),
  data?: {
    administratorInfo?: {
      buName?: string(name='BuName'),
      email?: string(name='Email'),
      logName?: string(name='LogName'),
      phoneNumber?: string(name='PhoneNumber'),
      realName?: string(name='RealName'),
    }(name='AdministratorInfo'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisplayInstanceUserSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisplayInstanceUserSaleResponseBody(name='body'),
}

async function displayInstanceUserSaleWithOptions(request: DisplayInstanceUserSaleRequest, runtime: Util.RuntimeOptions): DisplayInstanceUserSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    body['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisplayInstanceUserSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function displayInstanceUserSale(request: DisplayInstanceUserSaleRequest): DisplayInstanceUserSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return displayInstanceUserSaleWithOptions(request, runtime);
}

model DoLogicalDeleteInstanceRequest {
  accountId?: long(name='AccountId'),
}

model DoLogicalDeleteInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DoLogicalDeleteInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoLogicalDeleteInstanceResponseBody(name='body'),
}

async function doLogicalDeleteInstanceWithOptions(request: DoLogicalDeleteInstanceRequest, runtime: Util.RuntimeOptions): DoLogicalDeleteInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoLogicalDeleteInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doLogicalDeleteInstance(request: DoLogicalDeleteInstanceRequest): DoLogicalDeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return doLogicalDeleteInstanceWithOptions(request, runtime);
}

model FullSyncRequest {
  departmentInfos?: [ 
    {
      deptCode?: string(name='DeptCode'),
      deptHiding?: long(name='DeptHiding'),
      deptName?: string(name='DeptName'),
      deptOrder?: long(name='DeptOrder'),
      deptType?: string(name='DeptType'),
      ext?: string(name='Ext'),
      isDelete?: long(name='IsDelete'),
      parentCode?: string(name='ParentCode'),
    }
  ](name='DepartmentInfos'),
  orgId?: string(name='OrgId'),
  staffInfos?: [ 
    {
      depts?: [ 
        {
          id?: string(name='Id'),
          name?: string(name='Name'),
        }
      ](name='Depts'),
      email?: string(name='Email'),
      ext?: string(name='Ext'),
      isDelete?: long(name='IsDelete'),
      isDeptAdmin?: long(name='IsDeptAdmin'),
      mobile?: string(name='Mobile'),
      name?: string(name='Name'),
      nick?: string(name='Nick'),
      position?: string(name='Position'),
      remark?: string(name='Remark'),
      roles?: [ 
        {
          id?: string(name='Id'),
          name?: string(name='Name'),
        }
      ](name='Roles'),
      status?: long(name='Status'),
      tel?: string(name='Tel'),
      userId?: string(name='UserId'),
      workPlace?: string(name='WorkPlace'),
    }
  ](name='StaffInfos'),
  syncType?: string(name='SyncType'),
}

model FullSyncResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: float(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model FullSyncResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: FullSyncResponseBody(name='body'),
}

async function fullSyncWithOptions(request: FullSyncRequest, runtime: Util.RuntimeOptions): FullSyncResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.departmentInfos)) {
    query['DepartmentInfos'] = request.departmentInfos;
  }
  if (!Util.isUnset(request.orgId)) {
    query['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.staffInfos)) {
    query['StaffInfos'] = request.staffInfos;
  }
  if (!Util.isUnset(request.syncType)) {
    query['SyncType'] = request.syncType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'FullSync',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function fullSync(request: FullSyncRequest): FullSyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return fullSyncWithOptions(request, runtime);
}

model GetAliyunInstanceRouteSaleRequest {
  instanceId?: string(name='InstanceId'),
  projectId?: string(name='ProjectId'),
}

model GetAliyunInstanceRouteSaleResponseBody = {
  code?: string(name='Code'),
  data?: {
    routList?: [ 
      {
        ruleId?: string(name='RuleId'),
        ruleName?: string(name='RuleName'),
      }
    ](name='RoutList'),
    tenantId?: string(name='TenantId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetAliyunInstanceRouteSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAliyunInstanceRouteSaleResponseBody(name='body'),
}

async function getAliyunInstanceRouteSaleWithOptions(request: GetAliyunInstanceRouteSaleRequest, runtime: Util.RuntimeOptions): GetAliyunInstanceRouteSaleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAliyunInstanceRouteSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAliyunInstanceRouteSale(request: GetAliyunInstanceRouteSaleRequest): GetAliyunInstanceRouteSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAliyunInstanceRouteSaleWithOptions(request, runtime);
}

model GetByForeignIdRequest {
  foreignId?: string(name='ForeignId'),
  instanceId?: string(name='InstanceId'),
  sourceId?: long(name='SourceId'),
}

model GetByForeignIdResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetByForeignIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetByForeignIdResponseBody(name='body'),
}

async function getByForeignIdWithOptions(request: GetByForeignIdRequest, runtime: Util.RuntimeOptions): GetByForeignIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.foreignId)) {
    query['ForeignId'] = request.foreignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetByForeignId',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getByForeignId(request: GetByForeignIdRequest): GetByForeignIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getByForeignIdWithOptions(request, runtime);
}

model GetInstanceRequest {
  instanceName?: string(name='InstanceName'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
}

model GetInstanceResponseBody = {
  code?: string(name='Code'),
  data?: {
    hadSTS?: boolean(name='HadSTS'),
    instanceList?: [ string ](name='InstanceList'),
    pageNum?: int32(name='PageNum'),
    pageSize?: int32(name='PageSize'),
    tenantId?: long(name='TenantId'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceResponseBody(name='body'),
}

async function getInstanceWithOptions(request: GetInstanceRequest, runtime: Util.RuntimeOptions): GetInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstance(request: GetInstanceRequest): GetInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceWithOptions(request, runtime);
}

model GetInstanceListRequest {
  instanceName?: string(name='InstanceName'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  userId?: string(name='UserId'),
}

model GetInstanceListResponseBody = {
  code?: string(name='Code'),
  data?: {
    hadSTS?: boolean(name='HadSTS'),
    instanceList?: [ string ](name='InstanceList'),
    pageNum?: int32(name='PageNum'),
    pageSize?: int32(name='PageSize'),
    tenantId?: long(name='TenantId'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetInstanceListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceListResponseBody(name='body'),
}

async function getInstanceListWithOptions(request: GetInstanceListRequest, runtime: Util.RuntimeOptions): GetInstanceListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceList',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceList(request: GetInstanceListRequest): GetInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceListWithOptions(request, runtime);
}

model GetInstanceListSaleRequest {
  instanceName?: string(name='InstanceName'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  userId?: string(name='UserId'),
}

model GetInstanceListSaleResponseBody = {
  code?: string(name='Code'),
  data?: {
    hadSTS?: boolean(name='HadSTS'),
    instanceList?: [ string ](name='InstanceList'),
    pageNum?: int32(name='PageNum'),
    pageSize?: int32(name='PageSize'),
    tenantId?: long(name='TenantId'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetInstanceListSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceListSaleResponseBody(name='body'),
}

async function getInstanceListSaleWithOptions(request: GetInstanceListSaleRequest, runtime: Util.RuntimeOptions): GetInstanceListSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceListSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceListSale(request: GetInstanceListSaleRequest): GetInstanceListSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceListSaleWithOptions(request, runtime);
}

model GetInstanceSaleRequest {
  instanceName?: string(name='InstanceName'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
}

model GetInstanceSaleResponseBody = {
  code?: string(name='Code'),
  data?: {
    hadSTS?: boolean(name='HadSTS'),
    instanceList?: [ string ](name='InstanceList'),
    pageNum?: int32(name='PageNum'),
    pageSize?: int32(name='PageSize'),
    tenantId?: long(name='TenantId'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetInstanceSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceSaleResponseBody(name='body'),
}

async function getInstanceSaleWithOptions(request: GetInstanceSaleRequest, runtime: Util.RuntimeOptions): GetInstanceSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceSale(request: GetInstanceSaleRequest): GetInstanceSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceSaleWithOptions(request, runtime);
}

model GetUsersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  users?: [ 
    {
      displayName?: string(name='DisplayName'),
      mobilePhone?: string(name='MobilePhone'),
      userId?: long(name='UserId'),
      userName?: string(name='UserName'),
    }
  ](name='Users'),
}

model GetUsersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUsersResponseBody(name='body'),
}

async function getUsersWithOptions(runtime: Util.RuntimeOptions): GetUsersResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetUsers',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUsers(): GetUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUsersWithOptions(runtime);
}

model InitPlayAlimeSopRequest {
  app?: {
    locale?: string(name='Locale'),
    name?: string(name='Name'),
    platform?: string(name='Platform'),
    terminalType?: string(name='TerminalType'),
  }(name='App'),
  extParams?: map[string]string(name='ExtParams'),
  instanceId?: string(name='InstanceId'),
  member?: {
    id?: string(name='Id'),
    nick?: string(name='Nick'),
  }(name='Member'),
  sopFlowId?: string(name='SopFlowId'),
}

model InitPlayAlimeSopShrinkRequest {
  app?: {
    locale?: string(name='Locale'),
    name?: string(name='Name'),
    platform?: string(name='Platform'),
    terminalType?: string(name='TerminalType'),
  }(name='App'),
  extParamsShrink?: string(name='ExtParams'),
  instanceId?: string(name='InstanceId'),
  member?: {
    id?: string(name='Id'),
    nick?: string(name='Nick'),
  }(name='Member'),
  sopFlowId?: string(name='SopFlowId'),
}

model InitPlayAlimeSopResponseBody = {
  code?: string(name='Code'),
  data?: {
    uuid?: string(name='Uuid'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model InitPlayAlimeSopResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: InitPlayAlimeSopResponseBody(name='body'),
}

async function initPlayAlimeSopWithOptions(tmpReq: InitPlayAlimeSopRequest, runtime: Util.RuntimeOptions): InitPlayAlimeSopResponse {
  Util.validateModel(tmpReq);
  var request = new InitPlayAlimeSopShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.extParams)) {
    request.extParamsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.extParams, 'ExtParams', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.app)) {
    query['App'] = request.app;
  }
  if (!Util.isUnset(request.extParamsShrink)) {
    query['ExtParams'] = request.extParamsShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.member)) {
    query['Member'] = request.member;
  }
  if (!Util.isUnset(request.sopFlowId)) {
    query['SopFlowId'] = request.sopFlowId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InitPlayAlimeSop',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function initPlayAlimeSop(request: InitPlayAlimeSopRequest): InitPlayAlimeSopResponse {
  var runtime = new Util.RuntimeOptions{};
  return initPlayAlimeSopWithOptions(request, runtime);
}

model ListSopFlowsRequest {
  currentPage?: int32(name='CurrentPage'),
  flowId?: long(name='FlowId'),
  instanceId?: string(name='InstanceId'),
  keyword?: string(name='Keyword'),
  pageSize?: int32(name='PageSize'),
}

model ListSopFlowsResponseBody = {
  code?: string(name='Code'),
  data?: {
    currentPage?: int32(name='CurrentPage'),
    dataList?: [ 
      {
        cateId?: long(name='CateId'),
        cateName?: string(name='CateName'),
        flowId?: long(name='FlowId'),
        flowSceneCode?: string(name='FlowSceneCode'),
        gmtModified?: long(name='GmtModified'),
        gmtModifiedStr?: string(name='GmtModifiedStr'),
        modifierName?: string(name='ModifierName'),
        sopCode?: string(name='SopCode'),
        sopName?: string(name='SopName'),
        status?: string(name='Status'),
        statusDesc?: string(name='StatusDesc'),
      }
    ](name='DataList'),
    pageSize?: int32(name='PageSize'),
    totalSize?: int32(name='TotalSize'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListSopFlowsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSopFlowsResponseBody(name='body'),
}

async function listSopFlowsWithOptions(request: ListSopFlowsRequest, runtime: Util.RuntimeOptions): ListSopFlowsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.flowId)) {
    query['FlowId'] = request.flowId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.keyword)) {
    query['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSopFlows',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSopFlows(request: ListSopFlowsRequest): ListSopFlowsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSopFlowsWithOptions(request, runtime);
}

model ListXsInstancesRequest {
  name?: string(name='Name'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListXsInstancesResponseBody = {
  code?: string(name='Code'),
  commodityInstances?: [ 
    {
      administrator?: {
        name?: string(name='Name'),
        userName?: string(name='UserName'),
      }(name='Administrator'),
      chargetype?: string(name='Chargetype'),
      hadSTS?: boolean(name='HadSTS'),
      hotlineSeatNum?: int32(name='HotlineSeatNum'),
      instanceId?: string(name='InstanceId'),
      name?: string(name='Name'),
      onlineSeatNum?: int32(name='OnlineSeatNum'),
      prodLevel?: string(name='ProdLevel'),
      startData?: string(name='StartData'),
      status?: int32(name='Status'),
      tenantId?: long(name='TenantId'),
    }
  ](name='CommodityInstances'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalCount?: int32(name='TotalCount'),
}

model ListXsInstancesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListXsInstancesResponseBody(name='body'),
}

async function listXsInstancesWithOptions(request: ListXsInstancesRequest, runtime: Util.RuntimeOptions): ListXsInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListXsInstances',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listXsInstances(request: ListXsInstancesRequest): ListXsInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listXsInstancesWithOptions(request, runtime);
}

model ModifyUserRequest {
  buName?: string(name='BuName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  phoneNumber?: string(name='PhoneNumber'),
  userId?: long(name='UserId'),
}

model ModifyUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyUserResponseBody(name='body'),
}

async function modifyUserWithOptions(request: ModifyUserRequest, runtime: Util.RuntimeOptions): ModifyUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.buName)) {
    query['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyUser',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyUser(request: ModifyUserRequest): ModifyUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyUserWithOptions(request, runtime);
}

model ModifyXsInstanceRequest {
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
}

model ModifyXsInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyXsInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyXsInstanceResponseBody(name='body'),
}

async function modifyXsInstanceWithOptions(request: ModifyXsInstanceRequest, runtime: Util.RuntimeOptions): ModifyXsInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyXsInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyXsInstance(request: ModifyXsInstanceRequest): ModifyXsInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyXsInstanceWithOptions(request, runtime);
}

model PhysicalDeleteInstanceRequest {
  accountId?: long(name='AccountId'),
}

model PhysicalDeleteInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PhysicalDeleteInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PhysicalDeleteInstanceResponseBody(name='body'),
}

async function physicalDeleteInstanceWithOptions(request: PhysicalDeleteInstanceRequest, runtime: Util.RuntimeOptions): PhysicalDeleteInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PhysicalDeleteInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function physicalDeleteInstance(request: PhysicalDeleteInstanceRequest): PhysicalDeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return physicalDeleteInstanceWithOptions(request, runtime);
}

model PlayAlimeSopRequest {
  data?: {
    data?: string(name='Data'),
    nodeId?: string(name='NodeId'),
    nodeType?: string(name='NodeType'),
  }(name='Data'),
  instanceId?: string(name='InstanceId'),
  uuid?: string(name='Uuid'),
}

model PlayAlimeSopResponseBody = {
  code?: string(name='Code'),
  data?: {
    end?: boolean(name='End'),
    nodes?: [ 
      {
        body?: {
          bizCode?: string(name='BizCode'),
          cards?: [ 
            {
              cardId?: string(name='CardId'),
              type?: string(name='Type'),
            }
          ](name='Cards'),
          code?: string(name='Code'),
          extraParams?: string(name='ExtraParams'),
          options?: [ 
            {
              checked?: boolean(name='Checked'),
              optionId?: string(name='OptionId'),
              title?: string(name='Title'),
              value?: string(name='Value'),
            }
          ](name='Options'),
          sections?: [ 
            {
              collapseContent?: boolean(name='CollapseContent'),
              content?: string(name='Content'),
              hideTitle?: boolean(name='HideTitle'),
              id?: long(name='Id'),
              knowledgeTitle?: string(name='KnowledgeTitle'),
              title?: string(name='Title'),
            }
          ](name='Sections'),
        }(name='Body'),
        id?: string(name='Id'),
        title?: string(name='Title'),
        type?: string(name='Type'),
      }
    ](name='Nodes'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PlayAlimeSopResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PlayAlimeSopResponseBody(name='body'),
}

async function playAlimeSopWithOptions(request: PlayAlimeSopRequest, runtime: Util.RuntimeOptions): PlayAlimeSopResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.data)) {
    query['Data'] = request.data;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.uuid)) {
    query['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PlayAlimeSop',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function playAlimeSop(request: PlayAlimeSopRequest): PlayAlimeSopResponse {
  var runtime = new Util.RuntimeOptions{};
  return playAlimeSopWithOptions(request, runtime);
}

model QueryCommodityInstanceListRequest {
  accountId?: long(name='AccountId'),
}

model QueryCommodityInstanceListResponseBody = {
  code?: string(name='Code'),
  commodityInstances?: {
    commodityInstance?: [ 
    {
      endData?: long(name='EndData'),
      hotlineSeatNum?: int32(name='HotlineSeatNum'),
      instanceId?: string(name='InstanceId'),
      onlineSeatNum?: int32(name='OnlineSeatNum'),
      startData?: long(name='StartData'),
      status?: int32(name='Status'),
    }
  ](name='CommodityInstance')
  }(name='CommodityInstances'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryCommodityInstanceListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryCommodityInstanceListResponseBody(name='body'),
}

async function queryCommodityInstanceListWithOptions(request: QueryCommodityInstanceListRequest, runtime: Util.RuntimeOptions): QueryCommodityInstanceListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryCommodityInstanceList',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCommodityInstanceList(request: QueryCommodityInstanceListRequest): QueryCommodityInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCommodityInstanceListWithOptions(request, runtime);
}

model QueryHotlineDashboardInfoRequest {
  endDate?: long(name='EndDate'),
  instanceId?: string(name='InstanceId'),
  pageNum?: long(name='PageNum'),
  pageSize?: long(name='PageSize'),
  serviceId?: [ string ](name='ServiceId'),
  skillGroups?: [ string ](name='SkillGroups'),
  sortFields?: [ string ](name='SortFields'),
  startDate?: long(name='StartDate'),
}

model QueryHotlineDashboardInfoResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryHotlineDashboardInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryHotlineDashboardInfoResponseBody(name='body'),
}

async function queryHotlineDashboardInfoWithOptions(request: QueryHotlineDashboardInfoRequest, runtime: Util.RuntimeOptions): QueryHotlineDashboardInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  if (!Util.isUnset(request.skillGroups)) {
    query['SkillGroups'] = request.skillGroups;
  }
  if (!Util.isUnset(request.sortFields)) {
    query['SortFields'] = request.sortFields;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryHotlineDashboardInfo',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryHotlineDashboardInfo(request: QueryHotlineDashboardInfoRequest): QueryHotlineDashboardInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryHotlineDashboardInfoWithOptions(request, runtime);
}

model QuerySkillGroupsRequest {
  instanceId?: string(name='InstanceId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
}

model QuerySkillGroupsResponseBody = {
  currentPage?: int32(name='CurrentPage'),
  data?: [ 
    {
      channelType?: int32(name='ChannelType'),
      description?: string(name='Description'),
      displayName?: string(name='DisplayName'),
      skillGroupId?: long(name='SkillGroupId'),
      skillGroupName?: string(name='SkillGroupName'),
    }
  ](name='Data'),
  onePageSize?: int32(name='OnePageSize'),
  requestId?: string(name='RequestId'),
  totalPage?: int32(name='TotalPage'),
  totalResults?: int32(name='TotalResults'),
}

model QuerySkillGroupsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySkillGroupsResponseBody(name='body'),
}

async function querySkillGroupsWithOptions(request: QuerySkillGroupsRequest, runtime: Util.RuntimeOptions): QuerySkillGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySkillGroups',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function querySkillGroups(request: QuerySkillGroupsRequest): QuerySkillGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySkillGroupsWithOptions(request, runtime);
}

model ReleaseAliyunCommodityInstanceRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  instanceId?: string(name='InstanceId'),
}

model ReleaseAliyunCommodityInstanceResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ReleaseAliyunCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReleaseAliyunCommodityInstanceResponseBody(name='body'),
}

async function releaseAliyunCommodityInstanceWithOptions(request: ReleaseAliyunCommodityInstanceRequest, runtime: Util.RuntimeOptions): ReleaseAliyunCommodityInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseAliyunCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function releaseAliyunCommodityInstance(request: ReleaseAliyunCommodityInstanceRequest): ReleaseAliyunCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseAliyunCommodityInstanceWithOptions(request, runtime);
}

model ReleaseAliyunCommodityInstanceSaleRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  instanceId?: string(name='InstanceId'),
}

model ReleaseAliyunCommodityInstanceSaleResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ReleaseAliyunCommodityInstanceSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReleaseAliyunCommodityInstanceSaleResponseBody(name='body'),
}

async function releaseAliyunCommodityInstanceSaleWithOptions(request: ReleaseAliyunCommodityInstanceSaleRequest, runtime: Util.RuntimeOptions): ReleaseAliyunCommodityInstanceSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseAliyunCommodityInstanceSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function releaseAliyunCommodityInstanceSale(request: ReleaseAliyunCommodityInstanceSaleRequest): ReleaseAliyunCommodityInstanceSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseAliyunCommodityInstanceSaleWithOptions(request, runtime);
}

model ReleaseCommodityInstanceRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model ReleaseCommodityInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ReleaseCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReleaseCommodityInstanceResponseBody(name='body'),
}

async function releaseCommodityInstanceWithOptions(request: ReleaseCommodityInstanceRequest, runtime: Util.RuntimeOptions): ReleaseCommodityInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    query['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function releaseCommodityInstance(request: ReleaseCommodityInstanceRequest): ReleaseCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseCommodityInstanceWithOptions(request, runtime);
}

model RemoveSkillGroupRequest {
  instanceId?: string(name='InstanceId'),
  skillGroupId?: string(name='SkillGroupId'),
}

model RemoveSkillGroupResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RemoveSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RemoveSkillGroupResponseBody(name='body'),
}

async function removeSkillGroupWithOptions(request: RemoveSkillGroupRequest, runtime: Util.RuntimeOptions): RemoveSkillGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    body['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RemoveSkillGroup',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function removeSkillGroup(request: RemoveSkillGroupRequest): RemoveSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeSkillGroupWithOptions(request, runtime);
}

model RenewAliyunCommodityInstanceRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  instanceId?: string(name='InstanceId'),
}

model RenewAliyunCommodityInstanceResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RenewAliyunCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RenewAliyunCommodityInstanceResponseBody(name='body'),
}

async function renewAliyunCommodityInstanceWithOptions(request: RenewAliyunCommodityInstanceRequest, runtime: Util.RuntimeOptions): RenewAliyunCommodityInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RenewAliyunCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function renewAliyunCommodityInstance(request: RenewAliyunCommodityInstanceRequest): RenewAliyunCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewAliyunCommodityInstanceWithOptions(request, runtime);
}

model RenewAliyunCommodityInstanceSaleRequest {
  commodityList?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      commodityEdition?: int32(name='CommodityEdition'),
      commodityEndTime?: long(name='CommodityEndTime'),
      commodityName?: string(name='CommodityName'),
      commodityNum?: int32(name='CommodityNum'),
      commodityStartTime?: long(name='CommodityStartTime'),
      commodityType?: int32(name='CommodityType'),
      description?: string(name='Description'),
    }
  ](name='CommodityList'),
  instanceId?: string(name='InstanceId'),
}

model RenewAliyunCommodityInstanceSaleResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RenewAliyunCommodityInstanceSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RenewAliyunCommodityInstanceSaleResponseBody(name='body'),
}

async function renewAliyunCommodityInstanceSaleWithOptions(request: RenewAliyunCommodityInstanceSaleRequest, runtime: Util.RuntimeOptions): RenewAliyunCommodityInstanceSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityList)) {
    body['CommodityList'] = request.commodityList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RenewAliyunCommodityInstanceSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function renewAliyunCommodityInstanceSale(request: RenewAliyunCommodityInstanceSaleRequest): RenewAliyunCommodityInstanceSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewAliyunCommodityInstanceSaleWithOptions(request, runtime);
}

model RenewInstanceCommodityInstanceRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model RenewInstanceCommodityInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RenewInstanceCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RenewInstanceCommodityInstanceResponseBody(name='body'),
}

async function renewInstanceCommodityInstanceWithOptions(request: RenewInstanceCommodityInstanceRequest, runtime: Util.RuntimeOptions): RenewInstanceCommodityInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    query['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RenewInstanceCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function renewInstanceCommodityInstance(request: RenewInstanceCommodityInstanceRequest): RenewInstanceCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewInstanceCommodityInstanceWithOptions(request, runtime);
}

model ResumeCommodityInstanceRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model ResumeCommodityInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ResumeCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ResumeCommodityInstanceResponseBody(name='body'),
}

async function resumeCommodityInstanceWithOptions(request: ResumeCommodityInstanceRequest, runtime: Util.RuntimeOptions): ResumeCommodityInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    query['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResumeCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resumeCommodityInstance(request: ResumeCommodityInstanceRequest): ResumeCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return resumeCommodityInstanceWithOptions(request, runtime);
}

model SubmitRequest {
  clientToken?: string(name='ClientToken'),
}

model SubmitResponseBody = {
  requestId?: string(name='RequestId'),
}

model SubmitResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SubmitResponseBody(name='body'),
}

async function submitWithOptions(request: SubmitRequest, runtime: Util.RuntimeOptions): SubmitResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'Submit',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function submit(request: SubmitRequest): SubmitResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitWithOptions(request, runtime);
}

model SuspendCommodityInstanceRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
}

model SuspendCommodityInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SuspendCommodityInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SuspendCommodityInstanceResponseBody(name='body'),
}

async function suspendCommodityInstanceWithOptions(request: SuspendCommodityInstanceRequest, runtime: Util.RuntimeOptions): SuspendCommodityInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    query['CommodityInstanceId'] = request.commodityInstanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SuspendCommodityInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function suspendCommodityInstance(request: SuspendCommodityInstanceRequest): SuspendCommodityInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return suspendCommodityInstanceWithOptions(request, runtime);
}

model TestGetInstanceBaseInfoRequest {
  userId?: string(name='userId'),
}

model TestGetInstanceBaseInfoResponseBody = {
  code?: string(name='Code'),
  data?: {
    exts?: string(name='exts'),
  }(name='Data'),
  message?: string(name='Message'),
  success?: boolean(name='Success'),
}

model TestGetInstanceBaseInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestGetInstanceBaseInfoResponseBody(name='body'),
}

async function testGetInstanceBaseInfoWithOptions(request: TestGetInstanceBaseInfoRequest, runtime: Util.RuntimeOptions): TestGetInstanceBaseInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TestGetInstanceBaseInfo',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testGetInstanceBaseInfo(request: TestGetInstanceBaseInfoRequest): TestGetInstanceBaseInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return testGetInstanceBaseInfoWithOptions(request, runtime);
}

model TestGetUserByIdRequest {
  accessKeyId?: string(name='accessKeyId'),
  accessKeySecret?: string(name='accessKeySecret'),
  userId?: string(name='userId'),
}

model TestGetUserByIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    email?: string(name='Email'),
    foreignId?: string(name='ForeignId'),
    id?: string(name='Id'),
    nick?: string(name='Nick'),
    sourceId?: string(name='SourceId'),
    telephone?: string(name='Telephone'),
    type?: string(name='Type'),
    extraInfo?: string(name='extraInfo'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model TestGetUserByIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestGetUserByIdResponseBody(name='body'),
}

async function testGetUserByIdWithOptions(request: TestGetUserByIdRequest, runtime: Util.RuntimeOptions): TestGetUserByIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessKeyId)) {
    query['accessKeyId'] = request.accessKeyId;
  }
  if (!Util.isUnset(request.accessKeySecret)) {
    query['accessKeySecret'] = request.accessKeySecret;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TestGetUserById',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testGetUserById(request: TestGetUserByIdRequest): TestGetUserByIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return testGetUserByIdWithOptions(request, runtime);
}

model UpGradeInstanceRequest {
  chargeType?: string(name='ChargeType'),
  commodityInstanceId?: string(name='CommodityInstanceId'),
  hotlineSeatNum?: int32(name='HotlineSeatNum'),
  hotlineVersion?: string(name='HotlineVersion'),
  onlineSeatNum?: int32(name='OnlineSeatNum'),
  onlineVersion?: string(name='OnlineVersion'),
}

model UpGradeInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpGradeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpGradeInstanceResponseBody(name='body'),
}

async function upGradeInstanceWithOptions(request: UpGradeInstanceRequest, runtime: Util.RuntimeOptions): UpGradeInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.chargeType)) {
    query['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.commodityInstanceId)) {
    query['CommodityInstanceId'] = request.commodityInstanceId;
  }
  if (!Util.isUnset(request.hotlineSeatNum)) {
    query['HotlineSeatNum'] = request.hotlineSeatNum;
  }
  if (!Util.isUnset(request.hotlineVersion)) {
    query['HotlineVersion'] = request.hotlineVersion;
  }
  if (!Util.isUnset(request.onlineSeatNum)) {
    query['OnlineSeatNum'] = request.onlineSeatNum;
  }
  if (!Util.isUnset(request.onlineVersion)) {
    query['OnlineVersion'] = request.onlineVersion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpGradeInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function upGradeInstance(request: UpGradeInstanceRequest): UpGradeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return upGradeInstanceWithOptions(request, runtime);
}

model UpdateInstanceRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
  description?: string(name='Description'),
  name?: string(name='Name'),
}

model UpdateInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateInstanceResponseBody(name='body'),
}

async function updateInstanceWithOptions(request: UpdateInstanceRequest, runtime: Util.RuntimeOptions): UpdateInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    body['CommodityInstanceId'] = request.commodityInstanceId;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstance',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateInstance(request: UpdateInstanceRequest): UpdateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceWithOptions(request, runtime);
}

model UpdateInstanceSaleRequest {
  commodityInstanceId?: string(name='CommodityInstanceId'),
  description?: string(name='Description'),
  name?: string(name='Name'),
}

model UpdateInstanceSaleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateInstanceSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateInstanceSaleResponseBody(name='body'),
}

async function updateInstanceSaleWithOptions(request: UpdateInstanceSaleRequest, runtime: Util.RuntimeOptions): UpdateInstanceSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityInstanceId)) {
    body['CommodityInstanceId'] = request.commodityInstanceId;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateInstanceSale(request: UpdateInstanceSaleRequest): UpdateInstanceSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceSaleWithOptions(request, runtime);
}

model UpdateInstanceUserRequest {
  buName?: string(name='BuName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  phoneNumber?: string(name='PhoneNumber'),
}

model UpdateInstanceUserResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateInstanceUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateInstanceUserResponseBody(name='body'),
}

async function updateInstanceUserWithOptions(request: UpdateInstanceUserRequest, runtime: Util.RuntimeOptions): UpdateInstanceUserResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.buName)) {
    body['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.email)) {
    body['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceUser',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateInstanceUser(request: UpdateInstanceUserRequest): UpdateInstanceUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceUserWithOptions(request, runtime);
}

model UpdateInstanceUserSaleRequest {
  buName?: string(name='BuName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  phoneNumber?: string(name='PhoneNumber'),
}

model UpdateInstanceUserSaleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateInstanceUserSaleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateInstanceUserSaleResponseBody(name='body'),
}

async function updateInstanceUserSaleWithOptions(request: UpdateInstanceUserSaleRequest, runtime: Util.RuntimeOptions): UpdateInstanceUserSaleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.buName)) {
    body['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.email)) {
    body['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceUserSale',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateInstanceUserSale(request: UpdateInstanceUserSaleRequest): UpdateInstanceUserSaleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceUserSaleWithOptions(request, runtime);
}

model UpdateSkillGroupRequest {
  description?: string(name='Description'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  skillGroupId?: long(name='SkillGroupId'),
  skillGroupName?: string(name='SkillGroupName'),
}

model UpdateSkillGroupResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateSkillGroupResponseBody(name='body'),
}

async function updateSkillGroupWithOptions(request: UpdateSkillGroupRequest, runtime: Util.RuntimeOptions): UpdateSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillGroupName)) {
    query['SkillGroupName'] = request.skillGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateSkillGroup',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateSkillGroup(request: UpdateSkillGroupRequest): UpdateSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateSkillGroupWithOptions(request, runtime);
}

model XspaceAccessCfServiceRequest {
  appName?: string(name='AppName'),
  executorEmpId?: string(name='ExecutorEmpId'),
  upgradeTaskId?: string(name='UpgradeTaskId'),
}

model XspaceAccessCfServiceResponseBody = {
  code?: string(name='Code'),
  data?: {
    applyOrderUrl?: string(name='ApplyOrderUrl'),
    requestId?: string(name='RequestId'),
    statusCode?: string(name='StatusCode'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceAccessCfServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceAccessCfServiceResponseBody(name='body'),
}

async function xspaceAccessCfServiceWithOptions(request: XspaceAccessCfServiceRequest, runtime: Util.RuntimeOptions): XspaceAccessCfServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.executorEmpId)) {
    query['ExecutorEmpId'] = request.executorEmpId;
  }
  if (!Util.isUnset(request.upgradeTaskId)) {
    query['UpgradeTaskId'] = request.upgradeTaskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceAccessCfService',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceAccessCfService(request: XspaceAccessCfServiceRequest): XspaceAccessCfServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceAccessCfServiceWithOptions(request, runtime);
}

model XspaceCancelCfServiceRequest {
  sourceOrderId?: string(name='SourceOrderId'),
}

model XspaceCancelCfServiceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceCancelCfServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceCancelCfServiceResponseBody(name='body'),
}

async function xspaceCancelCfServiceWithOptions(request: XspaceCancelCfServiceRequest, runtime: Util.RuntimeOptions): XspaceCancelCfServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.sourceOrderId)) {
    query['SourceOrderId'] = request.sourceOrderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceCancelCfService',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceCancelCfService(request: XspaceCancelCfServiceRequest): XspaceCancelCfServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceCancelCfServiceWithOptions(request, runtime);
}

model XspaceEndCfServiceRequest {
  sourceOrderId?: string(name='SourceOrderId'),
}

model XspaceEndCfServiceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceEndCfServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceEndCfServiceResponseBody(name='body'),
}

async function xspaceEndCfServiceWithOptions(request: XspaceEndCfServiceRequest, runtime: Util.RuntimeOptions): XspaceEndCfServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.sourceOrderId)) {
    query['SourceOrderId'] = request.sourceOrderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceEndCfService',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceEndCfService(request: XspaceEndCfServiceRequest): XspaceEndCfServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceEndCfServiceWithOptions(request, runtime);
}

model XspaceQueryStatusCfServiceRequest {
  sourceOrderId?: string(name='SourceOrderId'),
}

model XspaceQueryStatusCfServiceResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceQueryStatusCfServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceQueryStatusCfServiceResponseBody(name='body'),
}

async function xspaceQueryStatusCfServiceWithOptions(request: XspaceQueryStatusCfServiceRequest, runtime: Util.RuntimeOptions): XspaceQueryStatusCfServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.sourceOrderId)) {
    query['SourceOrderId'] = request.sourceOrderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceQueryStatusCfService',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceQueryStatusCfService(request: XspaceQueryStatusCfServiceRequest): XspaceQueryStatusCfServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceQueryStatusCfServiceWithOptions(request, runtime);
}

model XspaceStartCfServiceRequest {
  appName?: string(name='AppName'),
  executorEmpId?: string(name='ExecutorEmpId'),
  sourceOrderId?: string(name='SourceOrderId'),
}

model XspaceStartCfServiceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceStartCfServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceStartCfServiceResponseBody(name='body'),
}

async function xspaceStartCfServiceWithOptions(request: XspaceStartCfServiceRequest, runtime: Util.RuntimeOptions): XspaceStartCfServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.executorEmpId)) {
    query['ExecutorEmpId'] = request.executorEmpId;
  }
  if (!Util.isUnset(request.sourceOrderId)) {
    query['SourceOrderId'] = request.sourceOrderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceStartCfService',
    version = '2019-11-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceStartCfService(request: XspaceStartCfServiceRequest): XspaceStartCfServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceStartCfServiceWithOptions(request, runtime);
}

